package com.hzd.web;

import ablaze.framework.api.result.ExecuteResult;
import com.hzd.condition.LandlordCondition;
import com.hzd.entity.Landlord;
import com.hzd.service.LandlordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author Kent
 * @date 2015/8/24.
 */
@Controller
@RequestMapping(value = "/landlord")
public class LandlordController {

    @Autowired
    private LandlordService landlordService;


    //------------------------------------PC端调用----------------------------------------
    @RequestMapping(value = "/list")
    public String tenantList(){
        return "rent/LandlordList";
    }

    @RequestMapping(value = "/findAll")
    @ResponseBody
    public List<Landlord> findAll(LandlordCondition condition){

        return landlordService.findAll(condition);
    }



    //------------------------------------手机端调用----------------------------------------

    @RequestMapping(value = "/store")
    @ResponseBody
    public ExecuteResult store(Landlord entity){

        return landlordService.saveOrUpdate(entity);
    }
}
